<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增学员信息')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-student-add">
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">资源时间：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="resourceTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" id="resource-time" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
<!--            <div class="col-xs-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">创建用户：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="createUser" class="form-control" type="text">-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">来源：</label>
                    <div class="col-sm-8">
                        <select name="resourceType" class="form-control" th:with="type=${@dict.getType('crm_resource_type')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">渠道：</label>
                    <div class="col-sm-8">
                        <select name="resourceCode" class="form-control" th:with="type=${@dict.getType('crm_resource_code')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
<!--                <div class="form-group">-->
<!--                    <label class="font-noraml">单选</label>-->
<!--                    <select class="form-control">-->
<!--                        <option value="">&#45;&#45;请选择开发语言&#45;&#45;</option>-->
<!--                        <option value="Java">Java</option>-->
<!--                        <option value="PHP">PHP</option>-->
<!--                        <option value=".NET">.NET</option>-->
<!--                    </select>-->
<!--                </div>-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">推广人员：</label>-->
<!--                    <div class="col-sm-8">-->
<!--&lt;!&ndash;                        <input name="resourceUserId" class="form-control" type="text">&ndash;&gt;-->
<!--                        <select id="resource-user" class="form-control select2-multiple">-->
<!--                            <option value=""></option>-->
<!--                            <option th:each="user:${users}" th:value="${user.userId}" th:text="${user.userName}"></option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
            </div>
<!--            <div class="col-xs-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">学员评级：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <select name="levelCode" class="form-control" th:with="type=${@dict.getType('crm_student_level')}">-->
<!--                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="col-xs-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">销售类型：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <select name="salesType" class="form-control" th:with="type=${@dict.getType('crm_sales_type')}">-->
<!--                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="col-xs-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">销售人员：</label>-->
<!--                    <div class="col-sm-8">-->
<!--&lt;!&ndash;                        <input name="salesmanId" class="form-control" type="text">&ndash;&gt;-->
<!--                        <select id="salesman" class="form-control">-->
<!--                            <option value="">&#45;&#45;请选择来源用户&#45;&#45;</option>&ndash;&gt;-->
<!--                            <option th:each="user:${users}" th:value="${user.userId}" th:text="${user.userName}"></option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">姓名：</label>
                    <div class="col-sm-8">
                        <input name="stuName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">手机号：</label>
                    <div class="col-sm-8">
                        <input name="stuMobile" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">固定电话：</label>
                    <div class="col-sm-8">
                        <input name="stuPhone" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">微信号：</label>
                    <div class="col-sm-8">
                        <input name="stuWechat" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">微信名：</label>
                    <div class="col-sm-8">
                        <input name="stuWechatName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">微信备注：</label>
                    <div class="col-sm-8">
                        <input name="stuWechatNote" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">QQ号：</label>
                    <div class="col-sm-8">
                        <input name="stuQq" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">其他联系方式：</label>
                    <div class="col-sm-8">
                        <input name="stuOtherContact" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">省份：</label>
                    <div class="col-sm-8">
                        <input name="stuProvince" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">城市：</label>
                    <div class="col-sm-8">
                        <input name="stuCity" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">详细地址：</label>
                    <div class="col-sm-8">
                        <input name="stuAddress" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">学历：</label>
                    <div class="col-sm-8">
                        <select name="stuEducationCode" class="form-control" th:with="type=${@dict.getType('crm_edu_code')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">毕业学校：</label>
                    <div class="col-sm-8">
                        <input name="stuCollege" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-2 control-label">客户需求：</label>
                    <div class="col-sm-10">
                        <textarea name="stuDamand" class="form-control" rows="6"></textarea>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-2 control-label">备注：</label>
                    <div class="col-sm-10">
                        <textarea name="note" class="form-control"></textarea>
                    </div>
                </div>
            </div>
<!--            <div class="col-xs-6">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-4 control-label">最后更新用户：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <input name="updateUser" class="form-control" type="text">-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "crm/promotion/student"
        $("#form-student-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-student-add").serializeArray();
                var resourceUserId = $.form.selectSelects("resource-user");
                var salesmanId = $.form.selectSelects("salesman");

                data.push({"name": "resourceUserId", "value": resourceUserId});
                data.push({"name": "salesmanId", "value": salesmanId});
                $.operate.save(prefix + "/add", data);
                // $.operate.save(prefix + "/add", $('#form-student-add').serialize());
            }
        }

        // $("input[name='resourceTime']").datetimepicker({
        //     format: "yyyy-mm-dd hh:ii",
        //     // minView: "month",
        //     autoclose: true
        // });

        $(function() {

            <!-- laydate -->
            layui.use('laydate', function(){
                var laydate = layui.laydate;
                laydate.render({
                    elem: '#resource-time',
                    type: 'datetime',
                    value: new Date(),
                    isInitValue: true,
                    trigger: 'click'
                });
            });

            $('#resource-user').select2({
                placeholder: "请选择推广人员",
                allowClear: true
            });

            $('#salesman').select2({
                placeholder: "请选择销售人员",
                allowClear: true
            });
        })
    </script>
</body>
</html>